package utils

import (
	"database/sql"
	"fmt"

	_ "github.com/go-sql-driver/mysql"
)

func Link_db() (*sql.DB, error) {
	dsn := "root:ed121212@tcp(127.0.0.1:3306)/english_snippet?parseTime=true&loc=Local"

	db, err := sql.Open("mysql", dsn)

	if err != nil {
		fmt.Printf("Failed to open database: %v\n", err)
		return nil, err
	}

	return db, nil
}
